package com.application.tourapp.baseadapter;

import com.application.tourapp.R;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import android.app.Activity;
import android.support.v4.view.ViewPager;


public class ImageSwipeAdapter extends PagerAdapter{
	Context context;
	public  int[] GalImages = new int[] {
			R.drawable.pyramide1, R.drawable.pyramide2,
            R.drawable.pyramide3, R.drawable.pyramide4
	};
	 
	public ImageSwipeAdapter(Context context){
		this.context=context;
	}
	@Override
	public int getCount() {
		return GalImages.length;
	}


	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		ImageView imageView = new ImageView(context);
		//attention
		int padding = context.getResources().getDimensionPixelSize(R.dimen.text_size_medium);
		imageView.setPadding(padding, padding, padding, padding);
		imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
		imageView.setImageResource(GalImages[position]);
		((ViewPager) container).addView(imageView, 0);
		return imageView;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		((ViewPager) container).removeView((ImageView) object);
	}
	@Override
	public boolean isViewFromObject(View view, Object object) {
		// TODO Auto-generated method stub
		return view == ((ImageView) object);
	}
}
